const path = require('path')
const CracoLessPlugin = require('craco-less') // less配置
const CracoCSSModules = require('craco-css-modules') // 简化模块化，xx.module.less => xx.less
const TypescriptCssModulesPlugin = require('typescript-plugin-css-modules') // ts支持css modules

module.exports = {
  devServer: {
    port: 8421
  },
  webpack: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            javascriptEnabled: true
          }
        }
      }
    },
    {
      // 简化模块化，xx.module.less => xx.less
      plugin: CracoCSSModules,
      options: {}
    },
    {
      plugin: TypescriptCssModulesPlugin // ts支持css modules css 模板提示
    }
  ]
}
